package common.util.BaseZtree;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BaseZTree {
	
	private String id; 
	private String pId; 
	private String label; 
	/*private String text; 
	private String nodeType; 
	private boolean isParent; 
	private boolean open; */
	private List<BaseZTree> children = new ArrayList<BaseZTree>();
	//private int position; 
	/**
     * 节点其他属性，传递其他属性zTree控件需要这样配置
     */ 
	/*private Map<String, String> attributes = new HashMap<String, String>();
	private String icon;*/
	public BaseZTree() { 
		
	} 
	public BaseZTree(String id, String label, String pId) { 
		this.id = id; 
		this.label = label; 
		this.pId = pId;
	} 
	
	
	 public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getpId() {
		return pId;
	}
	public void setpId(String pId) {
		this.pId = pId;
	}
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public List<BaseZTree> getChildren() {
		return children;
	}
	public void setChildren(List<BaseZTree> children) {
		this.children = children;
	}
	
	public void addChildren(BaseZTree baseZTree) { 
		 List<BaseZTree> nodes = this.getChildren(); 
		 if (nodes == null) { 
			 List<BaseZTree> list = new ArrayList<>();
			 list.add(baseZTree);
			 this.setChildren(list); 
		}else{ 
			nodes.add(baseZTree); 
		} 
	}
	

}
